package com.gds.wiki.cloud.orderCenter.client.order.hystrix;

import com.gds.wiki.cloud.framework.common.dto.ResponseDto;
import com.gds.wiki.cloud.framework.common.exception.BizExceptionEnum;
import com.gds.wiki.cloud.framework.common.utils.ResponseDtoFactory;
import com.gds.wiki.cloud.orderCenter.client.order.api.OrderApi;
import com.gds.wiki.cloud.orderCenter.client.order.model.Order;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class OrderApiFallbackFactory implements FallbackFactory<OrderApi> {

    public OrderApi create(Throwable throwable) {
        return new OrderApi() {
            @Override
            public ResponseDto getBySelf(Order order) {
                return   ResponseDtoFactory.GetInstance().build(BizExceptionEnum.API_EEROR);
            }

            @Override
            public ResponseDto asd() {
                return null;
            }
        };
    }
}

